from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token
from .views import statistical, users, specs, images, skus, orders, permissions, admin
from rest_framework.routers import SimpleRouter

urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    url(r'^statistical/total_count/$', statistical.UserCountView.as_view()),
    url(r'^statistical/day_increment/$', statistical.UserAddView.as_view()),
    url(r'^statistical/day_active/$', statistical.UserActiveView.as_view()),
    url(r'^statistical/day_orders/$', statistical.UserOrdersView.as_view()),
    url(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),
    url(r'^statistical/goods_day_views/$', statistical.GoodsDayView.as_view()),
    url(r'^users/$', users.UserView.as_view()),
    url(r'^goods/simple/$', specs.specsView.as_view({'get': 'simple'})),
    url(r'^skus/simple/$', images.ImageView.as_view({'get': 'simple'})),
    url(r'^goods/(?P<pk>\d+)/specs/$', skus.SKUView.as_view({'get': 'specs'})),
    url(r'^permission/content_types/$', permissions.PermissionView.as_view({'get': 'content_type'})),
    url(r'^permission/simple/$', permissions.GroupView.as_view({'get': 'simple'})),
    url(r'^permission/groups/simple/$', admin.AdminUser.as_view({'get': 'simple'})),

]

router = SimpleRouter()
router.register("goods/specs", specs.specsView, basename="specs")
urlpatterns += router.urls
router.register("skus/images", images.ImageView, basename="images")
urlpatterns += router.urls
router.register("skus", skus.SKUView, basename="skus")
urlpatterns += router.urls
router.register("orders", orders.OrderView, basename="orders")
urlpatterns += router.urls
router.register("permission/perms", permissions.PermissionView, basename="permission")
urlpatterns += router.urls

router.register("permission/groups", permissions.GroupView, basename="group")
urlpatterns += router.urls

router.register("permission/admins", admin.AdminUser, basename="user")
urlpatterns += router.urls
